using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using QuoteTree;

public partial class GetNodeAttributes : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //Set no cache
        this.Response.Cache.SetCacheability(HttpCacheability.NoCache);

        //Check is session is expired
        if (Session.IsNewSession)
        {
            // If it says it is a new session, but an existing cookie exists, then it must 
            // have timed out (can't use the cookie collection because even on first 
            // request it already contains the cookie (request and response
            // seem to share the collection)
            string szCookieHeader = Request.Headers["Cookie"];
            if ((null != szCookieHeader) && (szCookieHeader.IndexOf("ASP.NET_SessionId") >= 0))
            {
                this.Response.Write("timeout");
                return;
            }
        }

        QTree tree; string nodePath = "";
        if (this.Session["tree"] != null && this.Request.QueryString["nodePath"] != null && this.Request.QueryString["nodePath"].ToString() != "")
        {
            tree = this.Session["tree"] as QTree;
            nodePath = this.Request.QueryString["nodePath"].ToString();
        }
        else return;

        INode node = tree.GetNodeFromPath(nodePath);

        string response = "parentType=" + node.parent.type;
        this.Response.Write(response);

    }
}
